<?php

namespace App\Listeners;

use App\Events\CommentCommit;
use App\Services\MailService;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;

class SendCommentNotification
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  CommentCommit  $event
     * @return void
     */
    public function handle(CommentCommit $event)
    {
        $data = new \stdClass();
        $data->nickname = $event->data->name;
        $data->website  = $event->data->website;
        $data->email    = $event->data->email;
        $data->remark   = $event->data->remark;
        $mailSrv = new MailService();
        $mailSrv->sendEmailReminder($data);
    }
}
